/**
 * Created by tanyichao on 2017/4/12.
 */
const state = {
    //就餐时间 0稍后 1马上
    dineWay: 0,
    //就餐方式 0食堂 1打包 2净菜包
    isPackage: 0,
    //是否午餐 0午餐 1晚餐
    isLunch: 0,
    //就餐时间
    bookingTime: '',
    //是否是净菜包 0食堂 1打包 2净菜包
    packageType:0,
    //保存最近的orderId
    orderId:''
}
const mutations = {
    updateDineWay (state, payload) {
        state.dineWay = payload.dineWay;
        window.localStorage.setItem("DINE_WAY",payload.dineWay);
    },
    updateIsPackage (state, payload) {
        state.isPackage = payload.isPackage
    },
    updateIsLunch (state, payload) {
        state.isLunch = payload.isLunch
    },
    updateBookingTime (state, payload) {
        state.bookingTime = payload.bookingTime
    },
    updatePackageType (state, payload) {
        state.packageType = payload.packageType
    },
    updateOrderId (state, payload) {
        state.orderId = payload.orderId
    },
}
const actions = {
    updateDineWay ({commit}, dineWay) {
        commit({type: 'updateDineWay', dineWay: dineWay})
    },
    updateIsPackage ({commit}, isPackage) {
        commit({type: 'updateIsPackage', isPackage: isPackage})
    },
    updateIsLunch ({commit}, isLunch) {
        commit({type: 'updateIsLunch', isLunch: isLunch})
    },
    updateBookingTime ({commit}, bookingTime) {
        commit({type: 'updateBookingTime', bookingTime: bookingTime})
    },
    updatePackageType ({commit}, packageType) {
        commit({type: 'updatePackageType', packageType: packageType})
    },
    updateOrderId ({commit}, orderId) {
        commit({type: 'updateOrderId', orderId: orderId})
    },
}

export default {
    state,
    actions,
    mutations
}
